<!-- header.html -->
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"    xmlns:sec="http://www.thymeleaf.org/extras/spring-security" >
<head>
    <meta charset="UTF-8">
    <title>公共头部</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
</head>
<body>
<header>
    <!-- 公共头部内容 -->
    <nav class="navbar navbar-light bg-light"   th:fragment="commonHeader">
        <a  sec:authorize="isAuthenticated()" th:href="@{/home}">主页</a>
        <!-- 其他公共链接 -->
        <a sec:authorize="isAnonymous()" th:href="@{/login_page}"   >登录</a>
        <div> 教师成绩录入系统 </div>
        <!--如果已登录：用户账号，注销-->
        <div sec:authorize="isAuthenticated()">
            <a class="item">
                用户账号：<span sec:authentication="name"> </span>
            </a>
            <a  class="item">
                角色：<span      sec:authentication="principal.authorities"> </span>
            </a>
        </div>
        <a sec:authorize="isAuthenticated()" th:href="@{/logout}"    >退出</a>
    </nav>


    <!--侧边栏-->
    <nav class="col-md-2 d-none d-md-block bg-light sidebar" th:fragment="sidebar">
        <div class="sidebar-sticky">
            <ul class="nav flex-column">
                <li class="nav-item"  sec:authorize="hasAuthority('TEACHER') or hasAuthority('ADMIN') or hasAuthority('STUDENT')" >
                    <a class="nav-link" th:href="@{/index}">
                        首页 <span class="sr-only">(current)</span>
                    </a>
                </li>
                <h6 sec:authorize="hasAuthority('STUDENT')"  class="sidebar-heading d-flex justify-content-between align-items-center px-3 my-4 mb-1 text-muted">
                    <span>学生模块</span>
                </h6>
                <li class="nav-item"  sec:authorize="hasAuthority('STUDENT')">
                    <a class="nav-link" th:href="@{/StudentPersonalView} ">
                        成绩查看
                    </a>
                </li>
                <h6 sec:authorize="hasAuthority('TEACHER')"  class="sidebar-heading d-flex justify-content-between align-items-center px-3 my-4 mb-1 text-muted">
                    <span>教师模块</span>
                </h6>
                <li class="nav-item"  sec:authorize="hasAuthority('TEACHER')">
                    <a class="nav-link" th:href="@{/SC/}">
                        成绩录入
                    </a>
                </li>
                <h6 sec:authorize="hasAuthority('ADMIN')"  class="sidebar-heading d-flex justify-content-between align-items-center px-3 my-4 mb-1 text-muted">
                    <span>管理员模块</span>
                </h6>
                <li class="nav-item"  sec:authorize="hasAuthority('ADMIN')">
                    <a class="nav-link" th:href="@{/Student/}">
                        学生管理
                    </a>
                </li>
            </ul>
            <ul sec:authorize="hasAuthority('ADMIN')" class="nav flex-column mb-2">
                <li class="nav-item">
                    <a class="nav-link" th:href="@{/Teacher/}">
                        教师管理
                    </a>
                </li>
                <li class="nav-item" >
                    <a class="nav-link" th:href="@{/Course/}">
                        课程管理
                    </a>
                </li>
                <li class="nav-item" >
                    <a class="nav-link" th:href="@{/TC/}">
                        教师授课管理
                    </a>
                </li>
                <li class="nav-item" >
                    <a class="nav-link" th:href="@{/SC/}">
                        学生选课管理
                    </a>
                </li>
                <li class="nav-item" >
                    <a class="nav-link" th:href="@{/Myuser/}">
                        权限查看
                    </a>
                </li>
            </ul>
        </div>
    </nav>
    <!--底部-->
    <nav  class="bottom" th:fragment="bottom">
        <style>
            .bottom {
                text-align: center;
                color: #fff;
                font: normal 12px / 20px microsoft YaHei;
                margin: 15px 0 0;
                background-color: #0483d4;
                padding: 10px;
            }
        </style>
        <p>版权所有© Copyright 2024-2024 王子恒　　&nbsp;&nbsp;&nbsp;武汉轻工大学&nbsp;&nbsp;&nbsp; web进阶（教师成绩录入系统）&nbsp;&nbsp;&nbsp;版本V-1.0</p>
    </nav>
</header>
</body>
</html>